﻿namespace ACCOUNTING
{
    using ACCOUNTING.LVY.Business;
    using ACCOUNTING.My.Resources;
    using C1.Win.C1FlexGrid;
    using C1.Win.C1FlexGrid.Util.BaseControls;
    using Microsoft.VisualBasic;
    using Microsoft.VisualBasic.CompilerServices;
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Diagnostics;
    using System.Drawing;
    using System.Runtime.CompilerServices;
    using System.Windows.Forms;

    [DesignerGenerated]
    public class Frm_DieuKhoanBaoGia : Form
    {
        private static List<WeakReference> __ENCList = new List<WeakReference>();
        [AccessedThroughProperty("Button1")]
        private Button _Button1;
        [AccessedThroughProperty("CmdAddRow")]
        private Button _CmdAddRow;
        [AccessedThroughProperty("CmdDelRow")]
        private Button _CmdDelRow;
        [AccessedThroughProperty("cmdExit")]
        private Button _cmdExit;
        [AccessedThroughProperty("Panel1")]
        private Panel _Panel1;
        [AccessedThroughProperty("VSListDieuKhoan")]
        private C1.Win.C1FlexGrid.C1FlexGrid _VSListDieuKhoan;
        private IContainer components;
        private clsChiTietDieuKhoanChungTu objDK;
        public string strLoaiChungTu;

        public Frm_DieuKhoanBaoGia()
        {
            base.Load += new EventHandler(this.Frm_DieuKhoanBaoGia_Load);
            List<WeakReference> list = __ENCList;
            lock (list)
            {
                __ENCList.Add(new WeakReference(this));
            }
            this.objDK = new clsChiTietDieuKhoanChungTu();
            this.strLoaiChungTu = "";
            this.InitializeComponent();
        }

        private void Button1_Click(object sender, EventArgs e)
        {
            if ((this.VSListDieuKhoan.Rows.Count != 1) && (this.VSListDieuKhoan.Row > 0))
            {
                this.VSListDieuKhoan.Rows.Insert(this.VSListDieuKhoan.Row);
            }
        }

        private void CmdAddRow_Click(object sender, EventArgs e)
        {
            this.VSListDieuKhoan.AddItem("");
            this.VSListDieuKhoan.Select(this.VSListDieuKhoan.Rows.Count - 1, 2);
            this.VSListDieuKhoan.Focus();
        }

        private void CmdDelRow_Click(object sender, EventArgs e)
        {
            if ((this.VSListDieuKhoan.Rows.Count != 1) && (this.VSListDieuKhoan.Row > 0))
            {
                this.objDK.DeleteBaoGiaTemp(Conversions.ToString(this.VSListDieuKhoan[this.VSListDieuKhoan.Row, 0]));
                this.VSListDieuKhoan.RemoveItem(this.VSListDieuKhoan.Row);
            }
        }

        private void CmdExit_Click(object sender, EventArgs e)
        {
            this.Dispose();
        }

        [DebuggerNonUserCode]
        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        public void FillDieuKhoanTemplate()
        {
            DataTable dieuKhoanTemplate = this.objDK.GetDieuKhoanTemplate(this.strLoaiChungTu);
            this.VSListDieuKhoan.Select(0, 0);
            this.VSListDieuKhoan.Rows.Count = 1;
            int num2 = dieuKhoanTemplate.Rows.Count - 1;
            for (int i = 0; i <= num2; i++)
            {
                this.VSListDieuKhoan.AddItem("");
                this.VSListDieuKhoan[this.VSListDieuKhoan.Rows.Count - 1, 0] = RuntimeHelpers.GetObjectValue(dieuKhoanTemplate.Rows[i]["Khoa"]);
                this.VSListDieuKhoan[this.VSListDieuKhoan.Rows.Count - 1, 1] = RuntimeHelpers.GetObjectValue(dieuKhoanTemplate.Rows[i]["KhoaDieuKhoan"]);
                this.VSListDieuKhoan[this.VSListDieuKhoan.Rows.Count - 1, 2] = RuntimeHelpers.GetObjectValue(dieuKhoanTemplate.Rows[i]["DieuKhoan"]);
                this.VSListDieuKhoan[this.VSListDieuKhoan.Rows.Count - 1, 3] = RuntimeHelpers.GetObjectValue(dieuKhoanTemplate.Rows[i]["NoiDungViet"]);
                this.VSListDieuKhoan[this.VSListDieuKhoan.Rows.Count - 1, 4] = RuntimeHelpers.GetObjectValue(dieuKhoanTemplate.Rows[i]["NoiDungAnh"]);
                this.VSListDieuKhoan[this.VSListDieuKhoan.Rows.Count - 1, 5] = dieuKhoanTemplate.Rows[i]["HienThi"].ToString().Trim();
            }
        }

        private void Frm_DieuKhoanBaoGia_Load(object sender, EventArgs e)
        {
            Hashtable hashtable = new Hashtable();
            hashtable.Add("0", "In thường");
            hashtable.Add("1", "In đậm");
            this.VSListDieuKhoan.Cols[5].DataMap = hashtable;
            this.FillDieuKhoanTemplate();
        }

        [DebuggerStepThrough]
        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(Frm_DieuKhoanBaoGia));
            this.VSListDieuKhoan = new C1.Win.C1FlexGrid.C1FlexGrid();
            this.Panel1 = new Panel();
            this.Button1 = new Button();
            this.cmdExit = new Button();
            this.CmdDelRow = new Button();
            this.CmdAddRow = new Button();
            this.VSListDieuKhoan.BeginInit();
            this.Panel1.SuspendLayout();
            this.SuspendLayout();
            this.VSListDieuKhoan.BorderStyle = C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.Light3D;
            this.VSListDieuKhoan.ColumnInfo = manager.GetString("VSListDieuKhoan.ColumnInfo");
            this.VSListDieuKhoan.Dock = DockStyle.Fill;
            this.VSListDieuKhoan.ExtendLastCol = true;
            this.VSListDieuKhoan.KeyActionEnter = KeyActionEnum.MoveAcross;
            Point point = new Point(0, 0);
            this.VSListDieuKhoan.Location = point;
            this.VSListDieuKhoan.Name = "VSListDieuKhoan";
            this.VSListDieuKhoan.Rows.Count = 1;
            this.VSListDieuKhoan.Rows.DefaultSize = 0x11;
            this.VSListDieuKhoan.Rows.MinSize = 20;
            Size size = new Size(0x37e, 0x239);
            this.VSListDieuKhoan.Size = size;
            this.VSListDieuKhoan.StyleInfo = manager.GetString("VSListDieuKhoan.StyleInfo");
            this.VSListDieuKhoan.TabIndex = 0x20;
            this.VSListDieuKhoan.VisualStyle = VisualStyle.Office2007Blue;
            this.Panel1.Controls.Add(this.Button1);
            this.Panel1.Controls.Add(this.cmdExit);
            this.Panel1.Controls.Add(this.CmdDelRow);
            this.Panel1.Controls.Add(this.CmdAddRow);
            this.Panel1.Dock = DockStyle.Bottom;
            point = new Point(0, 0x21b);
            this.Panel1.Location = point;
            this.Panel1.Name = "Panel1";
            size = new Size(0x37e, 30);
            this.Panel1.Size = size;
            this.Panel1.TabIndex = 0x2d;
            this.Button1.Image = (Image) manager.GetObject("Button1.Image");
            this.Button1.ImageAlign = ContentAlignment.MiddleLeft;
            point = new Point(0xc3, 3);
            this.Button1.Location = point;
            this.Button1.Name = "Button1";
            size = new Size(0x5c, 0x18);
            this.Button1.Size = size;
            this.Button1.TabIndex = 0x30;
            this.Button1.Text = "&3.Ch\x00e8n d\x00f2ng";
            this.Button1.TextImageRelation = TextImageRelation.ImageBeforeText;
            this.Button1.UseVisualStyleBackColor = true;
            this.cmdExit.Image = ACCOUNTING.My.Resources.Resources.Closed;
            this.cmdExit.ImageAlign = ContentAlignment.MiddleLeft;
            point = new Point(0x329, 3);
            this.cmdExit.Location = point;
            this.cmdExit.Name = "cmdExit";
            size = new Size(0x52, 0x18);
            this.cmdExit.Size = size;
            this.cmdExit.TabIndex = 0x2f;
            this.cmdExit.Text = "Th&o\x00e1t";
            this.cmdExit.UseVisualStyleBackColor = true;
            this.CmdDelRow.Image = (Image) manager.GetObject("CmdDelRow.Image");
            this.CmdDelRow.ImageAlign = ContentAlignment.MiddleLeft;
            point = new Point(100, 3);
            this.CmdDelRow.Location = point;
            this.CmdDelRow.Name = "CmdDelRow";
            size = new Size(0x59, 0x18);
            this.CmdDelRow.Size = size;
            this.CmdDelRow.TabIndex = 0x2e;
            this.CmdDelRow.Text = "&2.X\x00f3a d\x00f2ng";
            this.CmdDelRow.TextImageRelation = TextImageRelation.ImageBeforeText;
            this.CmdDelRow.UseVisualStyleBackColor = true;
            this.CmdAddRow.Image = (Image) manager.GetObject("CmdAddRow.Image");
            this.CmdAddRow.ImageAlign = ContentAlignment.MiddleLeft;
            point = new Point(3, 3);
            this.CmdAddRow.Location = point;
            this.CmdAddRow.Name = "CmdAddRow";
            size = new Size(0x5c, 0x18);
            this.CmdAddRow.Size = size;
            this.CmdAddRow.TabIndex = 0x2d;
            this.CmdAddRow.Text = "&1.Th\x00eam d\x00f2ng";
            this.CmdAddRow.TextImageRelation = TextImageRelation.ImageBeforeText;
            this.CmdAddRow.UseVisualStyleBackColor = true;
            SizeF ef = new SizeF(6f, 13f);
            this.AutoScaleDimensions = ef;
            this.AutoScaleMode = AutoScaleMode.Font;
            size = new Size(0x37e, 0x239);
            this.ClientSize = size;
            this.ControlBox = false;
            this.Controls.Add(this.Panel1);
            this.Controls.Add(this.VSListDieuKhoan);
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
            this.Name = "Frm_DieuKhoanBaoGia";
            this.StartPosition = FormStartPosition.CenterScreen;
            this.Text = "DIEU KHOAN BAO GIA";
            this.VSListDieuKhoan.EndInit();
            this.Panel1.ResumeLayout(false);
            this.ResumeLayout(false);
        }

        private void VSListDieuKhoan_AfterEdit(object sender, RowColEventArgs e)
        {
            if (LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSListDieuKhoan[e.Row, 0]), "", modGeneral.TypeOfValue.Nothing).ToString().Trim() == "")
            {
                this.VSListDieuKhoan[e.Row, 0] = modGeneral.CreatKey("BH_DieuKhoanBaoGiaTemplate", 15, "");
            }
            clsChiTietDieuKhoanChungTu objDK = this.objDK;
            objDK.Khoa = Conversions.ToString(this.VSListDieuKhoan[e.Row, 0]);
            objDK.KhoaDieuKhoan = Conversions.ToString(this.VSListDieuKhoan[e.Row, 1]);
            objDK.NoiDungViet = LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSListDieuKhoan[e.Row, 3]), "", modGeneral.TypeOfValue.Nothing).ToString();
            objDK.NoiDungAnh = LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSListDieuKhoan[e.Row, 4]), "", modGeneral.TypeOfValue.Nothing).ToString();
            objDK.HienThi = Conversions.ToInteger(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSListDieuKhoan[e.Row, 5]), "0", modGeneral.TypeOfValue.Nothing));
            objDK.LoaiChungTu = this.strLoaiChungTu;
            objDK.STT = e.Row;
            objDK.SaveDieuKhoanTemp();
            objDK = null;
        }

        private void VSListDieuKhoan_CellButtonClick(object sender, RowColEventArgs e)
        {
            if (e.Col == 2)
            {
                string expression = SearchModule.SearchDieuKhoan("");
                if (expression.Trim() != "")
                {
                    object instance = Strings.Split(expression, "|", -1, CompareMethod.Binary);
                    this.VSListDieuKhoan[e.Row, 1] = RuntimeHelpers.GetObjectValue(NewLateBinding.LateIndexGet(instance, new object[] { 0 }, null));
                    this.VSListDieuKhoan[e.Row, 2] = RuntimeHelpers.GetObjectValue(NewLateBinding.LateIndexGet(instance, new object[] { 2 }, null));
                }
                this.VSListDieuKhoan.Select(e.Row, 3);
            }
        }

        private void VSListDieuKhoan_Click(object sender, EventArgs e)
        {
        }

        internal virtual Button Button1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Button1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.Button1_Click);
                if (this._Button1 != null)
                {
                    this._Button1.Click -= handler;
                }
                this._Button1 = value;
                if (this._Button1 != null)
                {
                    this._Button1.Click += handler;
                }
            }
        }

        internal virtual Button CmdAddRow
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdAddRow;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdAddRow_Click);
                if (this._CmdAddRow != null)
                {
                    this._CmdAddRow.Click -= handler;
                }
                this._CmdAddRow = value;
                if (this._CmdAddRow != null)
                {
                    this._CmdAddRow.Click += handler;
                }
            }
        }

        internal virtual Button CmdDelRow
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdDelRow;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdDelRow_Click);
                if (this._CmdDelRow != null)
                {
                    this._CmdDelRow.Click -= handler;
                }
                this._CmdDelRow = value;
                if (this._CmdDelRow != null)
                {
                    this._CmdDelRow.Click += handler;
                }
            }
        }

        internal virtual Button cmdExit
        {
            [DebuggerNonUserCode]
            get
            {
                return this._cmdExit;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdExit_Click);
                if (this._cmdExit != null)
                {
                    this._cmdExit.Click -= handler;
                }
                this._cmdExit = value;
                if (this._cmdExit != null)
                {
                    this._cmdExit.Click += handler;
                }
            }
        }

        internal virtual Panel Panel1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Panel1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Panel1 = value;
            }
        }

        internal virtual C1.Win.C1FlexGrid.C1FlexGrid VSListDieuKhoan
        {
            [DebuggerNonUserCode]
            get
            {
                return this._VSListDieuKhoan;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                RowColEventHandler handler = new RowColEventHandler(this.VSListDieuKhoan_CellButtonClick);
                EventHandler handler2 = new EventHandler(this.VSListDieuKhoan_Click);
                RowColEventHandler handler3 = new RowColEventHandler(this.VSListDieuKhoan_AfterEdit);
                if (this._VSListDieuKhoan != null)
                {
                    this._VSListDieuKhoan.CellButtonClick -= handler;
                    this._VSListDieuKhoan.Click -= handler2;
                    this._VSListDieuKhoan.AfterEdit -= handler3;
                }
                this._VSListDieuKhoan = value;
                if (this._VSListDieuKhoan != null)
                {
                    this._VSListDieuKhoan.CellButtonClick += handler;
                    this._VSListDieuKhoan.Click += handler2;
                    this._VSListDieuKhoan.AfterEdit += handler3;
                }
            }
        }
    }
}

